<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<?php
$x=10;
echo $x; // 输出10
echo "<br/>";
$y=20;
$y += 100;
echo $y; // 输出120
echo "<br/>";
$z=50;
$z -= 25;
echo $z; // 输出25
echo "<br/>";
$i=5;
$i *= 6;
echo $i; // 输出30
echo "<br/>";
$j=10;
$j /= 5;
echo $j; // 输出2
echo "<br/>";
$k=15;
$k %= 4;
echo $k; // 输出3
echo "<br/>";
$a = "Hello";
$b = $a . " world!";
echo $b; // 输出Hello world!
echo "<br/>";
$x="Hello";
$x .= " world!";
echo $x; // 输出Hello world!
echo "<br/>";
$x=10;
echo ++$x; // 输出11
echo "<br/>";
$y=10;
echo $y++; // 输出10
echo "<br/>";
$z=5;
echo --$z; // 输出4
echo "<br/>";
$i=5;
echo $i--; // 输出5
echo "<br/>";
$x=100;
$y="100";
echo "<br/>";
var_dump($x == $y);
echo "<br>";
var_dump($x === $y);
echo "<br>";
var_dump($x != $y);
echo "<br>";
var_dump($x !== $y);
echo "<br>";

$a=50;
$b=90;

var_dump($a > $b);
echo "<br>";
var_dump($a < $b);
echo "<br/>";
$x = array("a" => "red", "b" => "green");
$y = array("c" => "blue", "d" => "yellow");
$z = $x + $y; // $x 和 $y 数组合并
var_dump($z);echo "<br>";
var_dump($x == $y);
echo "<br>";
var_dump($x === $y);
echo "<br>";
var_dump($x != $y);
echo "<br>";
var_dump($x <> $y);
echo "<br>";
var_dump($x !== $y);
echo "<br>";
echo "三元运算";
$test = 'w3cschool在线教程';
// 普通写法
$username = isset($test) ? $test : 'nobody'; echo $username, PHP_EOL;
echo "<br>";
// PHP 5.3+ 版本写法
$username = $test ?: 'nobody'; echo $username, PHP_EOL;
echo "<br>";
?>
</body>
</html>